<?php
require("../../../../../libraries/config.php");
require("../../../../../libraries/dbclass2.php");
function xcrud_remove_post($id){
	$db=new db;
	$db->connect();
	$db->query('select * from index_post where id='.$id);
	$rc=$db->fetchOne();
		$pid=$rc['post_id'];
	if($rc['is_image']==1){
	
		$db->nonquery('delete from images where post_id='.$pid);
		$db->nonquery('delete from post_image where id='.$pid);
	}else
	if($rc['is_video']==1){
		$db->nonquery('delete from post_media where id='.$pid);
	}else
	if($rc['is_text']==1){
		$db->nonquery('delete from post_text where id='.$pid);
	}
	$db->close();


}

function xcrud_remove_post_image($id){
	$db=new db;
	$db->connect();
	$db->nonquery('delete from images where post_id='.$id);
	$db->nonquery('delete from index_post where post_id='.$id);
	$db->close();



}
function xcrud_remove_post_video($id){
	$db=new db;
	$db->connect();
	$db->nonquery('delete from index_post where post_id='.$id);
	$db->close();



}

?>
